<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<style>
			.bgc{
				height: 100px;
				width: 200px;
				background: linear-gradient(gray 20%,white 40%,white 40%);
			}
		</style>
	</head>

	<body>
		<p id="txt"></p>
		<div id="aaaa"></div>
		<script>
		
		window.onload =	function startTime()
			{
				var today=new Date();
				var h=today.getHours();
				var m=today.getMinutes();
				var s=today.getSeconds();
				var d = today.getDay();
				// add a zero in front of numbers<10
				m=checkTime(m);
				s=checkTime(s);
				document.getElementById("aaaa").innerHTML = d;
				document.getElementById('txt').innerHTML=h+":"+m+":"+s;
				t=setTimeout(function(){startTime()},500);
			}
			
			function checkTime(i)
			{
				if (i<10)
				  {
				  i="0" + i;
				  }
				return i;
			}
		</script>

	</body>

</html>